package com.bdqn.mapper;

import com.bdqn.pojo.HisRegistration;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface HisRegistrationMapper {
    @Insert("INSERT INTO `his_registration` VALUES (#{regId}, #{patientId}, #{patientName}, #{userId}, #{doctorName}, #{deptId}, #{regItemId}, #{regItemAmount}, #{regNumber}, #{regStatus}, #{visitDate}, #{schedulingType}, #{subsectionType}, #{createTime}, #{updateTime}, #{createBy})")
    int addHisRegistration(HisRegistration registration);
    List<HisRegistration> FuzzyQueryForPatients(String deptId, String name, String schedulingType, String subsectionType, String createTime);
    List<HisRegistration> selectAll(String doctorName,String visitDate);
    List<HisRegistration> selectAll2(String doctorName);
    @Update("UPDATE his_registration SET reg_status = 1 WHERE patient_id=#{id}")
    int chargeHisRegistration(String id);
    @Update("UPDATE his_registration SET reg_status = 4 WHERE patient_id=#{id}")
    int refundHisRegistration(String id);
    //查询待就诊患者信息
    @Select("SELECT * FROM his_registration WHERE reg_status = 1")
    List<HisRegistration> queryWithMedicalList();
    //查询就诊中患者信息
    @Select("SELECT * FROM his_registration WHERE reg_status = 2")
    List<HisRegistration> queryTheListOfVisitsInProgress();
    //查询就诊完成患者信息
    @Select("SELECT * FROM his_registration WHERE reg_status = 3")
    List<HisRegistration> queryTheListOfCompletedMedicalVisits();
    //接诊
    @Select("SELECT reg_id FROM his_registration WHERE patient_id = #{id}")
    String receiveAPatientForTreatment(String id);
    @Update("UPDATE his_registration SET reg_status = 2 WHERE patient_id= #{id}")
    int modifyReceiveAPatientForTreatment(String id);
    @Update("UPDATE his_registration SET reg_status = 3 WHERE reg_id=#{id}")
    int concludePatientVisit(String id);
}
